<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.jaxplat.commons.Row"%>
<%@page import="com.jaxplat.commons.RowImpl"%>
<%@page import="java.util.List"%>
<%@page import="com.jaxplat.util.DateUtils"%>
<%
    String contextPath = (String) request.getContextPath();
	Row orderInfo = new RowImpl();
	if(null != request.getAttribute("orderInfo"))
	{
	    orderInfo = (Row) request.getAttribute("orderInfo");
	}
	List orderBills = (List) request.getAttribute("orderBills");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css"
			href="<%=contextPath%>/js/jquery-easyui-1.3/themes/default/easyui.css">
		<link rel="stylesheet" href="<%=contextPath%>/css/main.css"
			type="text/css" />


		<link rel="stylesheet" type="text/css"
			href="<%=contextPath%>/js/jquery-easyui-1.3/themes/icon.css">
		<script type="text/javascript"
			src="<%=contextPath%>/js/jquery-easyui-1.3/jquery-1.7.2.min.js"></script>
		<script type="text/javascript"
			src="<%=contextPath%>/js/jquery-easyui-1.3/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="<%=contextPath%>/js/jquery-easyui-1.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">

function refundOrder(order_id)
{
	if(order_id==null || order_id=="")
	{
		return;
	}
	var param = 'orderId='+order_id;
	$.messager.confirm(
					'提示',
					'确定退号?',
					function(result) {
						if (!result) 
						{
							return;
						}
						//提交
						$.post('<%=contextPath%>/reserve/reserveMgr.do?method=refund',
								param,
								function(resp) 
								{
									var response = eval("(" + resp + ")");
									if(response.errcode=='0')
									{
										$.messager.alert('提示','退号成功!','info');
									}
									else
									{
										$.messager.alert('提示',response.message,'info');
									}
								});
					});
	
}

</script>
		<title>预约订单</title>
	</head>
	<body>
<div class="easyui-panel" data-options="fit:true,border:false" style="padding:2px 2px;">

	<div style="margin:5px;padding:5px;background:#fafafa;">
		<a href="#" onclick="refundOrder('<%=orderInfo.getString("order_id") %>')" class="easyui-linkbutton" data-options="iconCls:'icon-undo'">退号</a>
	</div>
	<h5 style="margin: 5px 10px;text-align: left;">
		订单信息
	</h5>
	<table class="doc-table">
		<tbody>
			<tr>
				<td colspan="4" style="background: #eee;text-align:left;">
					<strong>就医信息</strong>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>订单编号</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("order_id") %>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>提交时间</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%= DateUtils.parseDateTime(orderInfo.getDate("create_time"))  %>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>医院</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("hospital_name") %>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>科室</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("section_name") %>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>医生</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("doctor_name") %>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>预约时间</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%= DateUtils.parseDateTime(orderInfo.getDate("reserve_time"))  %>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>支付状态</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%
						String pay_status = "";
						if(orderInfo.getInt("pay_status") == 1)
						{
							pay_status = "未付费";
						}
						else if(orderInfo.getInt("pay_status") == 2)
						{
							pay_status = "已付费";
						}
						else if(orderInfo.getInt("pay_status") == 3)
						{
							pay_status = "已退费";
						}
						out.print(pay_status);
					%>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>预约状态</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<% 
					String reserve_status = "";
					if(orderInfo.getInt("reserve_status") == 1)
					{
						reserve_status = "保留状态";
					}
					else if(orderInfo.getInt("reserve_status") == 2)
					{
						reserve_status = "用户取消保留";
					}
					else if(orderInfo.getInt("reserve_status") == 3)
					{
						reserve_status = "保留过期";
					}
					else if(orderInfo.getInt("reserve_status") == 4)
					{
						reserve_status = "待赴约";
					}
					else if(orderInfo.getInt("reserve_status") == 5)
					{
						reserve_status = "用户取消预约";
					}
					else if(orderInfo.getInt("reserve_status") == 6)
					{
						reserve_status = "用户爽约";
					}
					else if(orderInfo.getInt("reserve_status") == 7)
					{
						reserve_status = "已赴约";
					}
					out.print(reserve_status);
					%>
				</td>
			</tr>
			<tr>
				<td colspan="4" style="background: #eee;text-align:left;">
					<strong>申请人信息</strong>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>申请人</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("applicant_name") %>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>证件号</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("id_no") %>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>性别</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=("m".equalsIgnoreCase(orderInfo.getString("gender"))?"男" : "女") %>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>出生日期</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("birth_date") %>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>手机号</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("mobile_no") %>
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>申请方式</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("apply_type") %>
				</td>
			</tr>
			<tr>
				<td style="text-align: right; width: 80px;">
					<strong>短信凭证</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					
						<%=orderInfo.getString("sms_cert") %>
					
				</td>
				<td style="text-align: right; width: 80px;">
					<strong>IP</strong>
				</td>
				<td style="text-align: left; width: 120px;">
					<%=orderInfo.getString("remote_ip") %>
				</td>
			</tr>

		</tbody>
	</table>
	<h5 style="margin: 5px 10px;text-align: left;">
		付款信息
	</h5>
	<table class="doc-table">
		<tbody>
			<tr>
				<th style="text-align: center; width: 80px;">
					<strong>支付方向</strong>
				</th>
				<th style="text-align: center; width: 80px;">
					<strong>金额</strong>
				</th>
				<th style="text-align: center; width: 80px;">
					<strong>支付类型</strong>
				</th>
				<th style="text-align: center; width: 80px;">
					<strong>经办人</strong>
				</th>
				<th style="text-align: center; width: 150px;">
					<strong>创建时间</strong>
				</th>
			</tr>
			<%
			if(null != orderBills)
			{
				for(int i=0; i < orderBills.size(); i++)
				{
				    Row orderBill = (Row)orderBills.get(i);
			%>
				<tr>
					<td style="text-align: center;">
						<%
							if("pay".equalsIgnoreCase(orderBill.getString("direction")))
							{
							    out.print("付款");
							}
							else
							{
							    out.print("退款");
							}
						%>
					</td>
					<td style="text-align: center;">
						<%=orderBill.getDouble("amount") %>
					</td>
					<td style="text-align: center;">
						<%
							if("user".equals(orderBill.getString("creator_type")))
							{
							    out.print("用户");
							}
							else
							{
							    out.print("操作员");
							}

						%>
					</td>
					<td style="text-align: center;">
						<%
							if("user".equals(orderBill.getString("creator_type")))
							{
							    out.print("--");
							}
							else
							{
							    out.print(orderBill.getString("creator_name"));
							}
						%>
					</td>
					<td style="text-align: center;">
						<%=DateUtils.parseDateTime(orderBill.getDate("create_time"))%>
					</td>
				</tr>
			<%
				}
			}
			%>
		</tbody>
	</table>

</div>
	</body>
</html>